home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / source / sci.lst < prev    next >
Encoding:
File List  |  1991-08-10  |  8.6 KB  |  253 lines

  1.  
  2. Motorola DSP56000 Macro Cross Assembler  Version 2.02  91-08-10  21:37:24  sci.asm  Page 1
  3.  
  4.  
  5.  
  6. 1                                  page    132,63,1,1
  7. 2                                  opt     rc
  8. 4      
  9. 5                        ;***************************************************************
  10. 6                        ;* SCI.ASM -- SCI drivers                                   *
  11. 7                        ;*                                                       *
  12. 8                        ;* Provides interrupt based SCI handling, and data buffering.  *
  13. 9                        ;*                                                       *
  14. 10                       ;* This module uses registers as follows:                     *
  15. 11                       ;*  r3 - xmit data pointer                                  *
  16. 12                       ;*                                                       *
  17. 13                       ;* Copyright (C) 1990, 1991 by Alef Null. All rights reserved. *
  18. 14                       ;* Author(s): Jarkko Vuori, OH2LNS                           *
  19. 15                       ;* Modification(s):                                        *
  20. 16                       ;***************************************************************
  21. 17     
  22. 225    
  23. 226                                section Sci
  24. 227                                xdef    baud
  25. 228                                xdef    sci_rec,sci_xmt
  26. 229                                xdef    sci_ini,putblk
  27. 230                                xref    m_scr,m_sccr,m_srxl,m_ssr,m_tie,m_stxl,m_stxm,m_stxh
  28. 231    
  29. 232       P:0000                   org     p:
  30. 233    
  31. 460    
  32. 461                      ; Serial interface parameters
  33. 462       00004B00       baud      equ     19200
  34. 463    
  35. 464    
  36. 465                      ;****************************
  37. 466                      ;*    SCI initialization    *
  38. 467                      ;****************************
  39. 468                      sci_ini
  40. 469                      ; initialize SCI
  41. 470                                IF      !0
  42. 471       P:0000 08F4B0            movep             #$0b02,x:m_scr ; async 8,n,1
  43.                  000B02
  44. 472       P:0002 08F4B2            movep             #20736000/(2*2*16*baud),x:m_sccr
  45.                  000010
  46. 473                                ELSE
  47. 476                                ENDIF
  48. 477    
  49. 478       P:0004 00000C            rts
  50. 479    
  51. 480    
  52. 481                      ;****************************
  53. 482                      ;*  Request to xmit block   *
  54. 483                      ;****************************
  55. 484                      ;starting address of the block in x0
  56. 485                      ;ending   address of the block in x1
  57. 486                      ;returns   C if transmitter busy
  58. 487                      ;         NC if request accepted
  59. 488                      putblk
  60. 489                      ; check if transmitter running
  61. 490       P:0005 0AB0AC            jset    #m_tie,x:m_scr,putblke
  62.                  00000F
  63.  
  64.  
  65. Motorola DSP56000 Macro Cross Assembler  Version 2.02  91-08-10  21:37:24  sci.asm  Page 2
  66. SCI port handling
  67.  
  68.  
  69. 491                      ; no, start transmitting header
  70. 492       P:0007 440000            move              x0,x:<stxblk
  71. 493       P:0008 450000            move              x1,x:<endblk
  72. 494       P:0009 63F400            move              #heablk,r3
  73.                  000057
  74. 495       P:000B 0A0020            bset    #header,x:<status
  75. 496       P:000C 08E374            movep             p:(r3),x:m_stxl
  76. 497       P:000D 0A0021            bset    #shift,x:<status
  77. 498       P:000E 0AB02C            bset    #m_tie,x:m_scr
  78. 499    
  79. 500       P:000F 00000C  putblke   rts
  80. 501    
  81. 502    
  82. 503                      ;****************************
  83. 504                      ;*   SCI xmitter interrupt  *
  84. 505                      ;****************************
  85. 506                      sci_xmt
  86. 507                      ; save registers to be used
  87. 508                                enter   scix
  88. 515    
  89. 516                      ; send appropriate byte of the word
  90. 517       P:0016 0A00A1            jset    #shift,x:<status,scix1
  91.                  00001B
  92. 518       P:0018 08E374            movep             p:(r3),x:m_stxl
  93. 519       P:0019 0A0021            bset    #shift,x:<status
  94. 520       P:001A 0C0000            jmp     <scx_end
  95. 521       P:001B 0B0002  scix1     bchg    #shftcnt,x:<status
  96. 522       P:001C 0E8000            jcs     <scix2
  97. 523       P:001D 08E375            movep             p:(r3),x:m_stxm
  98. 524       P:001E 0C0000            jmp     <scx_end
  99. 525       P:001F 08DB76  scix2     movep             p:(r3)+,x:m_stxh
  100. 526       P:0020 0A0001            bclr    #shift,x:<status
  101. 527    
  102. 528                      ; whole word send
  103. 529       P:0021 0A0080            jclr    #header,x:<status,scix3
  104.                  00002B
  105. 530                      ; sending header, check if end of it
  106. 531       P:0023 226E00            move              r3,a
  107. 532       P:0024 44F400            move              #heablk+healen,x0
  108.                  00005B
  109. 533       P:0026 200045            cmp     x0,a
  110. 534       P:0027 0E2000            jne     <scx_end
  111. 535                      ; yes, header sent, start sending datablock
  112. 536       P:0028 0A0000            bclr    #header,x:<status
  113. 537       P:0029 638000            move              x:<stxblk,r3
  114. 538       P:002A 0C0000            jmp     <scx_end
  115. 539                      ; sending datablock, check if the block has been sent
  116. 540       P:002B 226E00  scix3     move              r3,a
  117. 541       P:002C 448000            move              x:<endblk,x0
  118. 542       P:002D 200045            cmp     x0,a
  119. 543       P:002E 0E2000            jne     <scx_end
  120. 544                      ; yes, shut down transmitter
  121. 545       P:002F 0AB00C            bclr    #m_tie,x:m_scr
  122. 546    
  123. 547                      ; restore registers
  124. 548                      scx_end   leave   scix
  125. 556    
  126.  
  127.  
  128. Motorola DSP56000 Macro Cross Assembler  Version 2.02  91-08-10  21:37:24  sci.asm  Page 3
  129. SCI port handling
  130.  
  131.  
  132. 557    
  133. 558    
  134. 559                      ;****************************
  135. 560                      ;*   SCI receive interrupt  *
  136. 561                      ;****************************
  137. 562                      sci_rec
  138. 563                      ; save registers to be used
  139. 564                                enter   scir
  140. 571    
  141. 572                      ; read received character
  142. 573       P:003D 084434            movep             x:m_srxl,x0
  143. 574    
  144. 575                      ; check what to do with it
  145. 576       P:003E 56F400            move              #>'+',a
  146.                  00002B
  147. 577       P:0040 56F445            cmp     x0,a      #>'-',a
  148.                  00002D
  149. 578       P:0042 0EA000            jeq     <sci_r1
  150. 579       P:0043 200045            cmp     x0,a
  151. 580       P:0044 0E2000            jne     <scr_end
  152. 581    
  153. 582                      ; decrement N
  154. 583       P:0045 07F08E            move              p:NN2,a
  155.                  00005A
  156. 584       P:0047 200022            asr     a
  157. 585       P:0048 07708E            move              a,p:NN2
  158.                  00005A
  159. 586       P:004A 0C0000            jmp     <scr_end
  160. 587    
  161. 588                      ; increment N
  162. 589       P:004B 07F08E  sci_r1    move              p:NN2,a
  163.                  00005A
  164. 590       P:004D 200032            asl     a
  165. 591       P:004E 07708E            move              a,p:NN2
  166.                  00005A
  167. 592    
  168. 593                      ; restore registers
  169. 594                      scr_end   leave   scir
  170. 602    
  171. 603    
  172. 604                      ;****************************
  173. 605                      ;*       DATA - AREA       *
  174. 606                      ;****************************
  175. 607    
  176. 608                                xdef    NN2
  177. 609    
  178. 610       00000004       healen    equ     4
  179. 611                      heablk    dc      $010964
  180. 612                      version   dc      290791
  181. 613                      samplef   dc      8000      ; sample frequency
  182. 614                      NN2       dc      32        ; accumulator count
  183. 615    
  184. 616       X:0000                   org     x:
  185. 617    
  186. 618                      ; KISS-to-data queue
  187. 619       X:0000 000000  stxblk    ds      1
  188. 620       X:0001 000000  endblk    ds      1
  189.  
  190.  
  191. Motorola DSP56000 Macro Cross Assembler  Version 2.02  91-08-10  21:37:24  sci.asm  Page 4
  192. SCI port handling
  193.  
  194.  
  195. 621    
  196. 622                                endsec
  197. 623    
  198. 624                                end
  199. 0    Errors
  200. 0    Warnings
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.